<?php

namespace app\service;

use app\common\utils\Wechat;
use app\model\Config;

/**
 * 支付服务
 */
class PayService
{
    public $payment;
    /**
     * PayService constructor.
     * @param $payment
     */
    public function __construct($payment){
        $this->payment = $payment;
    }

    public function __call($name, $arguments){
        switch($this->payment){
            case 'wechat':
                $app_id = Config::getConfigValue('app_id');
                $mch_id = Config::getConfigValue('mch_id');
                $key = Config::getConfigValue('wechat_key');
                $payment = new Wechat($app_id,$mch_id,$key);
                return call_user_func_array([$payment, $name], $arguments);
                break;
            default:
                return '';
                break;
        }
    }
}
